package com.hzncc.scaffold.utils;

import java.awt.*;
import java.io.IOException;
import java.io.InputStream;

public class FontUtil {
    public static Font loadFont(String path, float size){
        try {
            InputStream fileStream = FontUtil.class.getResourceAsStream(path);
            Font myFont = Font.createFont(Font.TRUETYPE_FONT, fileStream);
            return myFont.deriveFont(Font.PLAIN, size);
        } catch (FontFormatException | IOException e) {
            e.printStackTrace();
            System.exit(1);
        }
        return null;
    }
}
